(()=>{
// 接口用来约束函数
interface SearchFunc{
    (source: string, subString: string): boolean; // 约束了函数有两个参数，还返回boolean值

}

// 函数的参数名不需要与接口里定义的名字相匹配
let mySearch: SearchFunc;
mySearch = function(source: string, subString: string):boolean{
    let result = source.search(subString);
    return result > -1;
}

console.log(mySearch('我变帅了','帅'))
console.log(mySearch('我变帅了','丑'))

})()